package com.idanchuang.user.count.service.api.client;

import com.idanchuang.component.base.JsonResult;
import com.idanchuang.user.count.service.api.request.command.count.UserMultiScenesCountResetCommand;
import com.idanchuang.user.count.service.api.request.command.count.UserMultiScenesCountUpdateCommand;
import com.idanchuang.user.count.service.api.request.command.count.UserSceneCountUpdateCommand;
import com.idanchuang.user.count.service.api.request.query.count.UserCountBatchQuery;
import com.idanchuang.user.count.service.api.request.query.count.UserCountQuery;
import com.idanchuang.user.count.service.api.response.UserMultiScenesCountDTO;
import com.idanchuang.user.count.service.api.response.UserSceneCountDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 用户计数服务
 * 处理与用户相关的简单计数请求
 *
 * @author Richard_yyf
 * @version 1.0 2021/5/21
 */
@FeignClient(value = "count-service", contextId = "count-service.user.count")
public interface UserCountServiceClient {

    String PREFIX = "/user/count-api";

    /**
     * 单一用户场景计数
     * @param userSceneCountUpdateCommand 计数请求
     * @return result
     */
    @PostMapping(PREFIX + "/count")
    JsonResult<Void> count(@RequestBody UserSceneCountUpdateCommand userSceneCountUpdateCommand);

    /**
     * 单一用户 多(/联动)场景计数
     * @param userMultiScenesCountUpdateCommand 批量(/联动)场景计数请求
     * @return result
     */
    @PostMapping(PREFIX + "/batchCount")
    JsonResult<Void> multiCount(@RequestBody UserMultiScenesCountUpdateCommand userMultiScenesCountUpdateCommand);

    /**
     * 批量对用户计数做重置
     * @param resetCommands 重置命令
     * @return result
     */
    @PostMapping(PREFIX + "/batchResetCount")
    JsonResult<Void> batchResetCount(@RequestBody List<UserMultiScenesCountResetCommand> resetCommands);

    /**
     * 单一用户 单一场景计数 查询
     * @param userCountQuery 单一场景计数 查询请求
     * @return result
     */
    @PostMapping(PREFIX + "/query")
    JsonResult<UserSceneCountDTO> query(@RequestBody UserCountQuery userCountQuery);

    /**
     * 单一用户 多个场景计数 批量查询
     * @param userCountBatchQuery 多场景计数 批量查询请求
     * @return result
     */
    @PostMapping(PREFIX + "/batchQuery")
    JsonResult<UserMultiScenesCountDTO> batchQuery(@RequestBody UserCountBatchQuery userCountBatchQuery);
}
